//
//  YXMarketVIew.m
//  跑跑快销
//
//  Created by 杨潇 on 14-4-28.
//  Copyright (c) 2014年 ylife. All rights reserved.
//

#import "YXMarketVIew.h"
#define BUTTONS 6
#define BTNH 89

@implementation YXMarketVIew
@synthesize count;

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        count = BUTTONS;
        self.backgroundColor = [UIColor lightGrayColor];
        NSArray * titleArr = [NSArray arrayWithObjects:@"订单管理",@"库存设置",@"单品销量",@"实时签到",@"货架陈列",@"工作计划", nil];
        float btnW = 320.0/3;
        for (int i = 0; i < BUTTONS; i ++) {
            UIButton * button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
            button.tag = i + 1;
            [button setTitle:[NSString stringWithFormat:@"%d",i+1] forState:UIControlStateNormal];
            button.backgroundColor = [UIColor whiteColor];
            button.frame = CGRectMake(btnW*(i%3), i/3*BTNH, btnW, BTNH);
            [self addSubview:button];
            
            UILabel * titleLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 74, btnW, 15)];
            titleLab.text = [titleArr objectAtIndex:i];
            titleLab.backgroundColor = [UIColor clearColor];
            titleLab.textAlignment = NSTextAlignmentCenter;
            titleLab.font = [UIFont systemFontOfSize:16];
            [button addSubview:titleLab];
        }
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
